package main.java.com.leng.controller;

import com.leng.SolorJ.JdDao;
import com.leng.pojo.ProductModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by presoul on 2017/6/17.
 */
@Controller
public class JdControlller {

    @Autowired
    private JdDao jdDao;

    @RequestMapping("/jdQuery")
    public String list(String queryString, String catalog_name, String price, String sort, Model model) {


        List<ProductModel> productModels = jdDao.selectProductModelListByQuery(queryString, catalog_name, price, sort);
        model.addAttribute("productModels", productModels);
        model.addAttribute("queryString", queryString);
        model.addAttribute("catalog_name", catalog_name);
        model.addAttribute("price", price);
        model.addAttribute("sort", sort);
        return "product_list";
    }

}
